home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc19 / gemfsc19.lzh / GNUGEM27 / VDIRAS.C < prev   
C/C++ Source or Header  |  1993-03-24  |  2KB  |  117 lines

  1. /*
  2.  *    Vdi raster funcs library interface
  3.  *
  4.  *        vro_cpyfm    copy raster opaque
  5.  *        vrt_cpyfm    copy raster transparent
  6.  *        vr_trnfm    transform form
  7.  *        v_get_pixel get pix
  8.  *
  9.  *            ++jrb    bammi@cadence.com
  10.  *            modified: mj -- ntomczak@vm.ucs.ualberta.ca
  11.  */
  12. #include "common.h"
  13.  
  14. #ifdef __DEF_ALL__
  15.  
  16. #define L_vro_cpyf
  17. #define L_vrt_cpyf
  18. #define L_vr_trnfm
  19. #define L_v_get_pi
  20.  
  21. #endif /* __DEF_ALL__ */
  22.  
  23.  
  24. #ifdef L_vro_cpyf
  25.  
  26. /* vro_cpyfm    copy raster opaque
  27.  * returns void
  28.  */
  29. void vro_cpyfm(int handle, int mode, int pxyarray[],
  30.            void *src,  void *dst)
  31. {
  32. #ifdef __MSHORT__        /* we have 16 bit ints, just change vdi params */
  33.     _vdiparams[2] = (void *) &pxyarray[0];
  34. #else                    /* 32 bit ints - let's copy */
  35.     register short i;
  36.  
  37.     for(i = 0; i < 8; i++)
  38.     _ptsin[i] = pxyarray[i];
  39. #endif
  40.  
  41.     _intin[0] = mode;
  42.     *((void **)(&_contrl[7])) = src;
  43.     *((void **)(&_contrl[9])) = dst;
  44.  
  45.     __vdi__(VDI_CONTRL_ENCODE(109, 4, 1, 0), handle);
  46.  
  47. #ifdef __MSHORT__
  48.     _vdiparams[2] = (void *)&_ptsin[0]; /* restore vdi parameters */
  49. #endif
  50. }
  51. #endif /* L_vro_cpyf */
  52.  
  53. #ifdef L_vrt_cpyf
  54.  
  55. /* vrt_cpyfm    copy raster transparent
  56.  * returns void
  57.  */
  58. void vrt_cpyfm(int handle, int mode, int pxyarray[],
  59.            void *src,  void *dst, int color[])
  60. {
  61. #ifdef __MSHORT__        /* we have 16 bit ints, just change vdi params */
  62.     _vdiparams[2] = (void *) &pxyarray[0];
  63. #else                    /* 32 bit ints - let's copy */
  64.     register short i;
  65.  
  66.     for(i = 0; i < 8; i++)
  67.     _ptsin[i] = pxyarray[i];
  68. #endif
  69.  
  70.     _intin[0] = mode;
  71.     _intin[1] = color[0];
  72.     _intin[2] = color[1];
  73.  
  74.     *((void **)(&_contrl[7])) = src;
  75.     *((void **)(&_contrl[9])) = dst;
  76.  
  77.     __vdi__(VDI_CONTRL_ENCODE(121, 4, 3, 0), handle);
  78.  
  79. #ifdef __MSHORT__
  80.     _vdiparams[2] = (void *)&_ptsin[0]; /* restore vdi parameters */
  81. #endif
  82. }
  83. #endif /* L_vrt_cpyf */
  84.  
  85. #ifdef L_vr_trnfm
  86.  
  87. /* vr_trnfm transform form
  88.  * returns void
  89.  */
  90. void vr_trnfm(int handle, void *src, void *dst)
  91. {
  92.     *((void **)(&_contrl[7])) = src;
  93.     *((void **)(&_contrl[9])) = dst;
  94.  
  95.     __vdi__(VDI_CONTRL_ENCODE(110, 0, 0, 0), handle);
  96. }
  97. #endif /* L_vr_trnfm */
  98.  
  99. #ifdef L_v_get_pi
  100.  
  101. /* v_get_pixel    get pix
  102.  * returns void (results in args)
  103.  */
  104. void v_get_pixel( int handle, int x, int y, int *pel, int *index)
  105. {
  106.     _ptsin[0] = x;
  107.     _ptsin[1] = y;
  108.  
  109.     __vdi__(VDI_CONTRL_ENCODE(105, 1, 0, 0), handle);
  110.  
  111.     *pel = _intout[0];
  112.     *index = _intout[1];
  113. }
  114. #endif /* L_v_get_pi */
  115.  
  116. /* -eof- */
  117.